export default{
    state:{
        // 控制菜单收缩
        isCollapse:false,
        // 面包屑数据
        tabList:[
            {
                path: "/",
                name: "home",
                label: "首页",
                icon: "s-home",
                url: "Home/Home",
            },
        ]
    },
    mutations:{
        collapseMenu(state){
            state.isCollapse =  !state.isCollapse
            console.log(state.isCollapse);
        },
        // 修改面包屑数据
        selectList(state,value){
            // 判断是否是首页的数据
            if(value.name !== 'home'){
               const index = state.tabList.findIndex(item =>item.name === value.name)
              //不存在时
               if (index === -1){
                state.tabList.push(value)
               }
            }
        },
        // 删除指定数据
        delTag(state,item){
           const index = state.tabList.findIndex(val => val.name === item.name)
           state.tabList.splice(index,1)
        }
    }
}